function ModuleDialogPublish(doc, container, width, height, user, date, options) {
  this._doc = doc;
  this._container = container;
  this._width = width;
  this._height = height;
  this._user = user;
  this._date = date;
  this._options = options;
  
  this._data = (options && options.data) ? options.data : null;
  this._item = (options && options.task) ? options.task : null;
  this._popupBox = (options && options.popupBox) ? options.popupBox : null;
  this._callbackFunc = (options && options.callback) ? options.callback : null;
  this._callbackFunc1 = (options && options.callback1) ? options.callback1 : null;
  this._pos = (options && options.pos) ? options.pos : null;
  this._pub = (options && options.pub) ? options.pub : false;
  
  this._oldTask = MiscUtils.clone(this._item);
  
  this._createElements();
};

ModuleDialogPublish.prototype._createElements = function() {
  var unique = MiscUtils.unique(), _self = this;
  this._gui = new DialogPublish(this._doc, this._container, this._width, this._height, this._user, this._date, this._options)._gui;
  
  if (this._pub || this._item.state_id >= 15) {
    this._gui.bName.disabled = true;
    this._gui.gName.disabled = true;
    this._gui.culture1.disabled = true;
    this._gui.addculture1.disabled = true;
    this._gui.culture2.disabled = true;
    this._gui.addculture2.disabled = true;
    this._gui.ceremony.disabled = true;
    this._gui.addceremony.disabled = true;
    this._gui.reception.disabled = true;
    this._gui.addreception.disabled = true;
    this._gui.weddingcolor.disabled = true;
    this._gui.addcolor.disabled = true;
    this._gui.photographer.disabled = true;
    this._gui.photographer2.disabled = true;
    this._gui.designer.disabled = true;
  } else {
    if (this._item.state_id < 7 || this._user.type != Constant.USER_TYPE_ADMINISTER) {
      this._gui.designer.disabled = true;
    }
  }
  
  this._photographers = this._data['photographer'].data;
  this._cultures = this._data['culture'].data;
  this._ceremonys = this._data['ceremony'].data;
  this._receptions = this._data['reception'].data;
  this._colors = this._data['color'].data;
  this._designers = this._data['designer'].data;
  
  MiscUtils.sort(this._cultures, ['name']);
  MiscUtils.sort(this._ceremonys, ['name']);
  MiscUtils.sort(this._receptions, ['name']);
  MiscUtils.sort(this._colors, ['name']);
  MiscUtils.sort(this._photographers, ['name']);
  MiscUtils.sort(this._designers, ['name']);
  
  this._popupBox2 = new ModulePopupBox();
  
  this._loadData();
};

ModuleDialogPublish.prototype._loadData = function() {
  DOMUtils.removeTableRows(this._gui.note, 1);
  var tr, td;
  tr = this._gui.note.insertRow(-1);
  td = tr.insertCell(-1);
  td.colSpan = 6;
  td.appendChild(DOMUtils.getLoadingImage());
  
  this._notes = null;
  this._retrieveNotes();
};

ModuleDialogPublish.prototype._verifyData = function() {
  if (this._notes) {
    this._updateElements();
  }
};

ModuleDialogPublish.prototype._retrieveNotes = function() {
  var _self = this;
  var args = '&c=t.task_id=' + this._item.id;
  new RequestUtils()._mysql('pz_task_note', args, function(result, params) { _self._notes = result.data;
                                                                             _self._verifyData.call(_self);
                                                                           }, null);
};

ModuleDialogPublish.prototype._updateElements = function() {
  var table, tr, td, radio, input, unique = MiscUtils.unique(), _self = this;

  DOMUtils.removeTableRows(this._gui.note, 1);
  DOMUtils.removeChildElements(this._gui.culture1);
  DOMUtils.removeChildElements(this._gui.culture2);
  DOMUtils.removeChildElements(this._gui.ceremony);
  DOMUtils.removeChildElements(this._gui.reception);
  DOMUtils.removeChildElements(this._gui.weddingcolor);
  DOMUtils.removeChildElements(this._gui.photographer);
  DOMUtils.removeChildElements(this._gui.photographer2);
  DOMUtils.removeChildElements(this._gui.designer);
  DOMUtils.removeChildElements(this._gui.score);
  DOMUtils.removeChildElements(this._gui.score2);
  DOMUtils.removeChildElements(this._gui.asstretouch);
  DOMUtils.removeChildElements(this._gui.adminretouch);
  
  
  if (this._notes.length == 0) {
    tr = this._gui.note.insertRow(-1);
    td = tr.insertCell(-1);
    td.colSpan = 6;
    td.style.height = '24px';
    td.style.textAlign = 'left';
    td.style.paddingLeft = '5px';
    td.appendChild(document.createTextNode('n/a'));
  }
  
  for (var i = 0, il = this._notes.length; i < il; i++) {
    var item = this._notes[i];
    tr = this._gui.note.insertRow(-1);
    
    td = tr.insertCell(-1);
    if (item.note_is_canceled == 1) {
      td.style.textDecoration = 'line-through';
    }
    td.style.height = '24px';
    td.style.textAlign = 'left';
    td.style.padding = '0 5px';
    td.appendChild(document.createTextNode(SimpleDate.format(SimpleDate.fromStamp(item.note_date))));
    
    td = tr.insertCell(-1);
    if (item.note_is_canceled == 1) {
      td.style.textDecoration = 'line-through';
    }
    td.style.textAlign = 'left';
    td.style.padding = '0 5px';
    td.appendChild(document.createTextNode((item.user) ? item.user : '-'));
    
    td = tr.insertCell(-1);
    var itable = document.createElement('table');
    itable.style.width = '100%';
    itable.cellPadding = 0;
    itable.cellSpacing = 0;
    td.appendChild(itable);
    
    itr = itable.insertRow(-1);
    itd = itr.insertCell(-1);
    if (item.note_is_canceled == 1) {
      itd.style.textDecoration = 'line-through';
    }
    itd.style.textAlign = 'left';
    itd.style.padding = '0 0 0 5px';
    itd.style.border = 0;
    itd.style.height = '23px';
    itd.style.lineHeight = '23px';
    var div = document.createElement('div');
    div.style.textOverflow = 'ellipsis';
    div.style.overflow = 'hidden';
    div.style.width = '240px';
    div.style.whiteSpace = 'nowrap';
    if (item.note_content.length != 0) {
      div.appendChild(document.createTextNode(item.note_content));
    } else {
      div.appendChild(document.createTextNode('(none)'));
    }
    itd.appendChild(div);
    
    itd = itr.insertCell(-1);
    itd.style.border = 0;
    var more = document.createElement('img');
    more.src = 'image/enlarge.png';
    more.style.cursor = 'pointer';
    more.style.marginRight = '3px';
    more.onclick = function() { var pos, func1, func2;
                                var pos = DOMUtils.findPos(this);
                                var popupBox = new ModulePopupBoxSimple();
                                var div = document.createElement('div');
                                func1 = function() { popupBox._close();
                                                   };
                                div.appendChild(MiscUtils.span(item.note_content));
                                MiscUtils.dialog(popupBox, pos, div, func1, null);
                                return false;
                                };
    if (item.note_content.length != 0 && item.note_content.length > 30) {
      itd.appendChild(more);
    }
    
    td = tr.insertCell(-1);
    td.style.textAlign = 'center';
    var remove = document.createElement('img');
    remove.src = 'image/delete.png';
    remove.style.cursor = 'pointer';
    remove._item = item;
    remove.onclick = function() { this._item.note_is_canceled = 1;
                                  var pos = DOMUtils.findPos(this);
                                  new RequestUtils()._write('pz_task_note', [this._item], [], function() { _self._retrieveNotes(); }, { pos: pos });
                                };
    if (item.note_is_canceled != 1 && this._item.is_canceled != 1 && item.is_planning == 0) {
      td.appendChild(remove);
    }
  }
  
  this._gui.is_wedding.checked = (this._item.is_wedding == 1) ? true : false;
  this._gui.is_wedding.onchange = function() { if (this.checked) {
                                                 _self._item.is_wedding = 1;
                                               } else {
                                                 _self._item.is_wedding = 0;
                                               }
                                             };
  
  this._gui.bName.value = this._item.bride_name;
  this._gui.bName.onchange = function() { _self._item.bride_name = this.value };
  
  this._gui.gName.value = this._item.groom_name;
  this._gui.gName.onchange = function() { _self._item.groom_name = this.value };
  
  this._gui.culture1.options[this._gui.culture1.options.length] = new Option('-');
  for (var i = 0, il = this._cultures.length; i < il; i++) {
    var culture = this._cultures[i];
    option = new Option(culture.name);
    this._gui.culture1.options[this._gui.culture1.options.length] = option;
    if (option.text == this._item.culture1) {
      this._gui.culture1.selectedIndex = this._gui.culture1.options.length - 1;
    }
  }
  this._gui.culture1.onchange = function() { _self._item.culture1 = (this.options[this.selectedIndex].text != '-') ? this.options[this.selectedIndex].text : ''; };
  
  this._gui.addculture1.onclick = function() { var object = pz_culture.instance();
                                               var div = document.createElement('div');
                                               var pos = DOMUtils.findPos(this);
                                               var func1 = function() { _self._popupBox2._close();
                                                                        _self._retrieveCultures.call(_self);
                                                                      };
                                               var func = function() { _self._popupBox2._close();
                                                                       _self._item.culture1 = object.name;
                                                                       new RequestUtils()._write('pz_culture', [object], [], function() { _self._retrieveCultures.call(_self); }, { pos: pos });
                                                                     };
                                               MiscUtils.dialog(_self._popupBox2, pos, div, func1, null, { t: 'Add Culture', width: 750, height: 50, func: func1});
                                               new ModuleDialogObject(document, div, 460, 100, _self._user, _self._date, { object: object, name: 'pz_culture', title: 'Cultures', textTitle: 'Culture', callbackFunc: func });
                                             };
  
  this._gui.culture2.options[this._gui.culture2.options.length] = new Option('-');
  for (var i = 0, il = this._cultures.length; i < il; i++) {
    var culture = this._cultures[i];
    option = new Option(culture.name);
    this._gui.culture2.options[this._gui.culture2.options.length] = option;
    if (option.text == this._item.culture2) {
      this._gui.culture2.selectedIndex = this._gui.culture2.options.length - 1;
    }
  }
  this._gui.culture2.onchange = function() { _self._item.culture2 = (this.options[this.selectedIndex].text != '-') ? this.options[this.selectedIndex].text : ''; };
  
  this._gui.addculture2.onclick = function() { var object = pz_culture.instance();
                                                var div = document.createElement('div');
                                                var pos = DOMUtils.findPos(this);
                                                var func1 = function() { _self._popupBox2._close();
                                                                         _self._retrieveCultures.call(_self);
                                                                       };
                                                var func = function() { _self._popupBox2._close();
                                                                        _self._item.culture2 = object.name;
                                                                        new RequestUtils()._write('pz_culture', [object], [], function() { _self._retrieveCultures.call(_self); }, { pos: pos });
                                                                      };
                                                MiscUtils.dialog(_self._popupBox2, pos, div, func1, null, { t: 'Add Culture', width: 750, height: 50, func: func1});
                                                new ModuleDialogObject(document, div, 460, 100, _self._user, _self._date, { object: object, name: 'pz_culture', title: 'Cultures', textTitle: 'Culture', callbackFunc: func });
                                              };
  
  this._gui.ceremony.options[this._gui.ceremony.options.length] = new Option('-');
  for (var i = 0, il = this._ceremonys.length; i < il; i++) {
    var ceremony = this._ceremonys[i];
    option = new Option(ceremony.name);
    this._gui.ceremony.options[this._gui.ceremony.options.length] = option;
    if (option.text == this._item.ceremony) {
      this._gui.ceremony.selectedIndex = this._gui.ceremony.options.length - 1;
    }
  }
  this._gui.ceremony.onchange = function() { _self._item.ceremony = (this.options[this.selectedIndex].text != '-') ? this.options[this.selectedIndex].text : ''; };
  
  this._gui.addceremony.onclick = function() { var object = pz_ceremony.instance();
                                                var div = document.createElement('div');
                                                var pos = DOMUtils.findPos(this);
                                                var func1 = function() { _self._popupBox2._close();
                                                                         _self._retrieveCeremonys.call(_self);
                                                                       };
                                                var func = function() { _self._popupBox2._close();
                                                                        _self._item.ceremony = object.name;
                                                                        new RequestUtils()._write('pz_ceremony', [object], [], function() { _self._retrieveCeremonys.call(_self); }, { pos: pos });
                                                                      };
                                                MiscUtils.dialog(_self._popupBox2, pos, div, func1, null, { t: 'Add Ceremony', width: 750, height: 50, func: func1});
                                                new ModuleDialogObject(document, div, 460, 100, _self._user, _self._date, { object: object, name: 'pz_ceremony', title: 'Ceremonys', textTitle: 'Ceremony', callbackFunc: func });
                                              };

  this._gui.reception.options[this._gui.reception.options.length] = new Option('-');
  for (var i = 0, il = this._receptions.length; i < il; i++) {
    var reception = this._receptions[i];
    option = new Option(reception.name);
    this._gui.reception.options[this._gui.reception.options.length] = option;
    if (option.text == this._item.reception) {
      this._gui.reception.selectedIndex = this._gui.reception.options.length - 1;
    }
  }
  this._gui.reception.onchange = function() { _self._item.reception = (this.options[this.selectedIndex].text != '-') ? this.options[this.selectedIndex].text : ''; };
  
  this._gui.addreception.onclick = function() { var object = pz_reception.instance();
                                                var div = document.createElement('div');
                                                var pos = DOMUtils.findPos(this);
                                                var func1 = function() { _self._popupBox2._close();
                                                                         _self._retrieveReceptions.call(_self);
                                                                       };
                                                var func = function() { _self._popupBox2._close();
                                                                        _self._item.reception = object.name;
                                                                        new RequestUtils()._write('pz_reception', [object], [], function() { _self._retrieveReceptions.call(_self); }, { pos: pos });
                                                                      };
                                                MiscUtils.dialog(_self._popupBox2, pos, div, func1, null, { t: 'Add Reception', width: 750, height: 50, func: func1});
                                                new ModuleDialogObject(document, div, 460, 100, _self._user, _self._date, { object: object, name: 'pz_reception', title: 'Receptions', textTitle: 'Reception', callbackFunc: func });
                                              };
  
  this._gui.weddingcolor.options[this._gui.weddingcolor.options.length] = new Option('-');
  for (var i = 0, il = this._colors.length; i < il; i++) {
    var color = this._colors[i];
    option = new Option(color.name);
    this._gui.weddingcolor.options[this._gui.weddingcolor.options.length] = option;
    if (option.text == this._item.wedding_color) {
      this._gui.weddingcolor.selectedIndex = this._gui.weddingcolor.options.length - 1;
    }
  }
  this._gui.weddingcolor.onchange = function() { _self._item.wedding_color = (this.options[this.selectedIndex].text != '-') ? this.options[this.selectedIndex].text : ''; };
  
  this._gui.addcolor.onclick = function() { var object = pz_color.instance();
                                            var div = document.createElement('div');
                                            var pos = DOMUtils.findPos(this);
                                            var func1 = function() { _self._popupBox2._close();
                                                                     _self._retrieveColors.call(_self);
                                                                   };
                                            var func = function() { _self._popupBox2._close();
                                                                    _self._item.wedding_color = object.name;
                                                                    new RequestUtils()._write('pz_color', [object], [], function() { _self._retrieveColors.call(_self); }, { pos: pos });
                                                                  };
                                            MiscUtils.dialog(_self._popupBox2, pos, div, func1, null, { t: 'Add Color', width: 750, height: 50, func: func1});
                                            new ModuleDialogObject(document, div, 460, 100, _self._user, _self._date, { object: object, name: 'pz_color', title: 'Colors', textTitle: 'Color', callbackFunc: func });
                                          };
  
  
  this._gui.photographer.options[this._gui.photographer.options.length] = new Option('-');
  for (var i = 0, il = this._photographers.length; i < il; i++) {
    var u = this._photographers[i];
//    if (u.branch != this._item.branch) {
//      continue;
//    }
    if (this._item.branch == Constant.BRANCH_AKL) {
      if (u.is_akl == 0) {
        continue;
      }
    } else if (this._item.branch == Constant.BRANCH_SYD) {
      if (u.is_syd == 0) {
        continue;
      }
    } else if (this._item.branch == Constant.BRANCH_MEL) {
      if (u.is_mel == 0) {
        continue;
      }
    } else if (this._item.branch == Constant.BRANCH_XTRAO) {
      if (u.is_xtrao == 0) {
        continue;
      }
    } else if (this._item.branch == Constant.BRANCH_NYC) {
      if (u.is_nyc == 0) {
        continue;
      }
    } else if (this._item.branch == Constant.BRANCH_BNE) {
      if (u.is_bne == 0) {
        continue;
      }
    } else {
      continue;
    }
    var str = PPublishUtils.branchShow(u);
    option = new Option(u.name + '(' + str + ')');
    option._u = u;
    this._gui.photographer.options[this._gui.photographer.options.length] = option;
    if (option._u.id == this._item.photographer_id) {
      this._gui.photographer.selectedIndex = this._gui.photographer.options.length - 1;
    }
  }
  
  this._gui.photographer.onchange = function() { _self._item.photographer_id = (this.options[this.selectedIndex]._u) ? this.options[this.selectedIndex]._u.id : 0; };
  
  this._gui.photographer2.options[this._gui.photographer2.options.length] = new Option('-');
  for (var i = 0, il = this._photographers.length; i < il; i++) {
    var u = this._photographers[i];
//    if (u.branch != this._item.branch) {
//      continue;
//    }
    if (this._item.branch == Constant.BRANCH_AKL) {
      if (u.is_akl == 0) {
        continue;
      }
    } else if (this._item.branch == Constant.BRANCH_SYD) {
      if (u.is_syd == 0) {
        continue;
      }
    } else if (this._item.branch == Constant.BRANCH_MEL) {
      if (u.is_mel == 0) {
        continue;
      }
    } else if (this._item.branch == Constant.BRANCH_XTRAO) {
      if (u.is_xtrao == 0) {
        continue;
      }
    } else if (this._item.branch == Constant.BRANCH_NYC) {
      if (u.is_nyc == 0) {
        continue;
      }
    } else if (this._item.branch == Constant.BRANCH_BNE) {
      if (u.is_bne == 0) {
        continue;
      }
    } else {
      continue;
    }
    var str = PPublishUtils.branchShow(u);
    option = new Option(u.name + '(' + str + ')');
    option._u = u;
    this._gui.photographer2.options[this._gui.photographer2.options.length] = option;
    if (option._u.id == this._item.photographer2_id) {
      this._gui.photographer2.selectedIndex = this._gui.photographer2.options.length - 1;
    }
  }
  
  this._gui.photographer2.onchange = function() { _self._item.photographer2_id = (this.options[this.selectedIndex]._u) ? this.options[this.selectedIndex]._u.id : 0; };
  
  this._gui.designer.options[this._gui.designer.options.length] = new Option('-');
  for (var i = 0, il = this._designers.length; i < il; i++) {
    var u = this._designers[i];
    option = new Option(u.name);
    option._u = u;
    this._gui.designer.options[this._gui.designer.options.length] = option;
    if (option._u.id == this._item.designer_id) {
      this._gui.designer.selectedIndex = this._gui.designer.options.length - 1;
    }
  }
  
  this._gui.designer.onchange = function() { if (this.options[this.selectedIndex]._u) {
                                               _self._item.designer_id = this.options[this.selectedIndex]._u.id; 
                                               _self._item.is_choose_designer = 1;
                                               _self._item.choosedesigner_date = (_self._oldTask.choosedesigner_date) ? _self._oldTask.choosedesigner_date : _self._date;
                                               _self._item.state_id = (_self._oldTask.state_id < 9) ? 9 : _self._oldTask.state_id;
                                             } else {
                                               _self._item.designer_id = 0;
                                               _self._item.is_choose_designer = 0;
                                               _self._item.choosedesigner_date = 0;
                                               _self._item.state_id = _self._oldTask.state_id;
                                             }
  };
  
  table = document.createElement('table');
  table.cellPadding = 0;
  table.cellSpacing = 0;
  this._gui.score.appendChild(table);
  
  tr = table.insertRow(-1);
  for (var i = 0, il = Score.array().length; i < il; i++) {
    var score = Score.array()[i];
    td = tr.insertCell(-1);
    td.style.padding = '0 1px';
    radio = DOMUtils.createInput(unique + '_score1', null, 'radio', null, null);
    radio.checked = (this._item.score == score);
    radio._score = score;
    if (radio.checked) {
      this._item.score = score;
    }
    if (this._pub) {
      radio.disabled = true;
    } else {
      radio.disabled = (this._item.state_id < 4 || this._item.state_id >= 15) ? true : false
    }
    radio.onclick = function() { _self._item.score = this._score;
                               };
    td.appendChild(radio);
    
    td = tr.insertCell(-1);
    td.style.padding = '0 1px';
    td.style.textAlign = 'left';
    td.appendChild(document.createTextNode(score));
  }
  
  table2 = document.createElement('table');
  table2.cellPadding = 0;
  table2.cellSpacing = 0;
  this._gui.score2.appendChild(table2);
  
  tr = table2.insertRow(-1);
  for (var i = 0, il = Score.array().length; i < il; i++) {
    var score = Score.array()[i];
    td = tr.insertCell(-1);
    td.style.padding = '0 1px';
    radio = DOMUtils.createInput(unique + '_score2', null, 'radio', null, null);
    radio.checked = (this._item.score2 == score);
    radio._score = score;
    if (radio.checked) {
      this._item.score2 = score;
    }
    if (this._pub) {
      radio.disabled = true;
    } else {
      radio.disabled = (this._item.state_id < 4 || this._item.state_id >= 15 || this._item.photographer2_id == 0) ? true : false
    }
    radio.onclick = function() { _self._item.score2 = this._score;
                               };
    td.appendChild(radio);
    
    td = tr.insertCell(-1);
    td.style.padding = '0 1px';
    td.style.textAlign = 'left';
    td.appendChild(document.createTextNode(score));
  }
  
  /*--asst 修片--*/
  table1 = document.createElement('table');
  table1.cellPadding = 0;
  table1.cellSpacing = 0;
  this._gui.asstretouch.appendChild(table1);
  
  tr1 = table1.insertRow(-1);
  td1 = tr1.insertCell(-1);
  td1.style.padding = '0 1px';
  radio0 = DOMUtils.createInput(unique + '_ssasst', null, 'radio', 1, null);
  radio0.checked = (this._item.is_asst_retouched == radio0.value);
  
  if (radio0.checked) {
    this._item.is_asst_retouched = radio0.value;
  }
  if (this._pub) {
    radio0.disabled = true;
  } else {
    radio0.disabled = (this._item.state_id < 4 || this._item.state_id >= 15) ? true : false
  }
  radio0.onclick = function() { _self._item.is_asst_retouched = this.value;
                                if (_self._oldTask.is_asst_retouched != _self._item.is_asst_retouched) {
                                  _self._item.asstretouched_date = _self._date;
                                  _self._item.state_id = 5;
                                  _self._item.deadline = parseInt(_self._date, 10) + 86400 * 3;
                                } else {
                                  _self._item.asstretouched_date = _self._oldTask.asstretouched_date;
                                  _self._item.state_id = _self._oldTask.state_id;
                                  _self._item.deadline = _self._oldTask.deadline;
                                }
                              };
  td1.appendChild(radio0);
  
  td1 = tr1.insertCell(-1);
  td1.style.padding = '0 1px';
  td1.style.textAlign = 'left';
  td1.appendChild(document.createTextNode('修片'));
  
  td1 = tr1.insertCell(-1);
  td1.style.padding = '0 1px';
  radio1 = DOMUtils.createInput(unique + '_ssasst', null, 'radio', 0, null);
  radio1.checked = (this._item.is_asst_retouched == radio1.value);
  
  if (radio1.checked) {
    this._item.is_asst_retouched = radio1.value;
  }
  if (this._pub) {
    radio1.disabled = true;
  } else {
    radio1.disabled = (this._item.state_id < 4 || this._item.state_id >= 15) ? true : false
  }
  radio1.onclick = function() { _self._item.is_asst_retouched = this.value;
                                if (_self._oldTask.is_asst_retouched != _self._item.is_asst_retouched) {
                                  _self._item.asstretouched_date = 0;
                                  _self._item.state_id = 4;
                                  _self._item.deadline = parseInt(_self._date, 10) + 86400 * 3;
                                } else {
                                  _self._item.asstretouched_date = _self._oldTask.asstretouched_date;
                                  _self._item.state_id = _self._oldTask.state_id;
                                  _self._item.deadline = _self._oldTask.deadline;
                                }
                             };
  td1.appendChild(radio1);
  
  td1 = tr1.insertCell(-1);
  td1.style.padding = '0 1px';
  td1.style.textAlign = 'left';
  td1.appendChild(document.createTextNode('不修片'));
  
  
  /*--admin 修片--*/
  table2 = document.createElement('table');
  table2.cellPadding = 0;
  table2.cellSpacing = 0;
  this._gui.adminretouch.appendChild(table2);
  
  tr1 = table2.insertRow(-1);
  td1 = tr1.insertCell(-1);
  td1.style.padding = '0 1px';
  radio0 = DOMUtils.createInput(unique + '_ssadmin', null, 'radio', 1, null);
  radio0.checked = (this._item.is_admin_retouched == radio0.value);
  
  if (radio0.checked) {
    this._item.is_admin_retouched = radio0.value;
  }
  if (this._pub) {
    radio0.disabled = true;
  } else {
    radio0.disabled = (this._item.state_id < 7 || this._item.state_id >= 15 || this._user.type != Constant.USER_TYPE_ADMINISTER) ? true : false
  }
  radio0.onclick = function() { _self._item.is_admin_retouched = this.value;
                                if (_self._oldTask.is_admin_retouched != _self._item.is_admin_retouched) {
                                  _self._item.adminretouched_date = _self._date;
                                  _self._item.is_admin_checked = this.value;
                                  _self._item.checked_date = 0;
                                  _self._item.state_id = 8;
                                  _self._item.deadline = parseInt(_self._date, 10) + 86400 * 3;
                                }
                             };
  td1.appendChild(radio0);
  
  td1 = tr1.insertCell(-1);
  td1.style.padding = '0 1px';
  td1.style.textAlign = 'left';
  td1.appendChild(document.createTextNode('修片'));
  
  td1 = tr1.insertCell(-1);
  td1.style.padding = '0 1px';
  radio1 = DOMUtils.createInput(unique + '_ssadmin', null, 'radio', 0, null);
  radio1.checked = (this._item.is_admin_retouched == radio1.value);
  
  if (radio1.checked) {
    this._item.is_admin_retouched = radio1.value;
  }
  if (this._pub) {
    radio1.disabled = true;
  } else {
    radio1.disabled = (this._item.state_id < 7 || this._item.state_id >= 15 || this._user.type != Constant.USER_TYPE_ADMINISTER) ? true : false
  }
  radio1.onclick = function() { _self._item.is_admin_retouched = this.value;
                                if (_self._oldTask.is_admin_retouched != _self._item.is_admin_retouched) { 
                                  _self._item.adminretouched_date = 0;
                                  _self._item.is_admin_checked = this.value;
                                  _self._item.checked_date = 0;
                                  _self._item.state_id = 7;
                                  _self._item.deadline = parseInt(_self._date, 10) + 86400 * 3;
                                }
                             };
  td1.appendChild(radio1);
  
  td1 = tr1.insertCell(-1);
  td1.style.padding = '0 1px';
  td1.style.textAlign = 'left';
  td1.appendChild(document.createTextNode('不修片'));
  
  this._gui.ok.onclick = function() {  _self._popupBox._close();
                                      if (_self._pub) {
                                        _self._callbackFunc1();
                                      } else {
                                        if (PPublishUtils.diff(_self._oldTask, _self._item)) {
                                          if (_self._item.is_asst_retouched == 0) {
                                            _self._item.is_choose_designer = 0;
                                            _self._item.choosedesigner_date = 0;
                                            _self._item.is_admin_retouched = 0;
                                            _self._item.adminretouched_date = 0;
                                            _self._item.is_admin_checked = 0;
                                            _self._item.checked_date = 0;
                                          }
                                          if (_self._item.is_admin_retouched == 0) {
                                            _self._item.is_choose_designer = 0;
                                            _self._item.choosedesigner_date = 0;
                                            _self._item.designer_id = 0;
                                          }
                                          new RequestUtils()._write('pz_task', [_self._item], [], function() { _self._callbackFunc(); if (_self._notes.length != 0) { _self._callbackFunc1(); } }, {pos: _self._pos});
                                        } else {
                                          if (_self._notes.length != 0) {
                                            _self._callbackFunc1(); 
                                          }
                                        }
                                      }
                                    };
  
  this._gui.add.onclick = function() { var div = document.createElement('div');
                                       var pos = DOMUtils.findPos(this);
                                       var popupBox = new ModulePopupBox();
                                       var note = pz_task_note.instance();
                                       var func1 = function() { if (note._text == '') {
                                                                  window.alert('CAN NOT BE EMPTY');
                                                                  return;
                                                                }
                                                                note.note_user_id = _self._user.id;
                                                                note.note_date = _self._date;
                                                                note.task_id = _self._item.id;
                                                                note.note_content = note._text;
                                                                new RequestUtils()._write('pz_task_note', [note], [], function() { _self._retrieveNotes(); }, { pos: pos });
                                                                popupBox._close();
                                                              };
                                      var func2 = function() { popupBox._close(); };
                                      MiscUtils.dialog(popupBox, pos, div, func1, func2, { t: 'Add A Note', width: 500, height: 50 });
                                      new ModuleDialogInput(document, div, null, null, _self._user, _self._date, {object: note, dfault: note.note_content});
                                    };
  this._gui.cancel.onclick = function() { _self._popupBox._close();
                                          if (_self._pub) {
                                            _self._callbackFunc1();
                                          } else {
                                            _self._callbackFunc();
                                            if (_self._notes.length != 0) {
                                              _self._callbackFunc1();
                                            }
                                          }
                                        };
};


ModuleDialogPublish.prototype._retrieveCultures = function() {
  var _self = this;
  var args = '';
  new RequestUtils()._mysql('getCultures', args, function(result, params) { _self._cultures = result;
                                                                            _self._updateElements();
                                                                          },  null);
};

ModuleDialogPublish.prototype._retrieveCeremonys = function() {
  var _self = this;
  var args = '';
  new RequestUtils()._mysql('getCeremonys', args, function(result, params) { _self._ceremonys = result;
                                                                             _self._updateElements();
                                                                           },  null);
};

ModuleDialogPublish.prototype._retrieveReceptions = function() {
  var _self = this;
  var args = '';
  new RequestUtils()._mysql('getReceptions', args, function(result, params) { _self._receptions = result;
                                                                              _self._updateElements();
                                                                            },  null);
};

ModuleDialogPublish.prototype._retrieveColors = function() {
  var _self = this;
  var args = '';
  new RequestUtils()._mysql('getColors', args, function(result, params) { _self._colors = result;
                                                                          _self._updateElements();
                                                                        },  null);
};